<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
<title><?php echo C('WEB_SITE_TITLE');?></title>
<link href="/Crawler/Public/static/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="/Crawler/Public/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<link href="/Crawler/Public/static/bootstrap/css/docs.css" rel="stylesheet">
<link href="/Crawler/Public/static/bootstrap/css/onethink.css" rel="stylesheet">
<link href="/Crawler/Public/static/icon/css/font-awesome.min.css" rel="stylesheet" />
<link rel="stylesheet" href="/Crawler/Public/Home/css/douban.css" />

<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="/Crawler/Public/static/bootstrap/js/html5shiv.js"></script>
<![endif]-->

<!--[if lt IE 9]>
<script type="text/javascript" src="/Crawler/Public/static/jquery-1.10.2.min.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script type="text/javascript" src="/Crawler/Public/static/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="/Crawler/Public/static/bootstrap/js/bootstrap.min.js"></script>
<!--<![endif]-->
<!-- 页面header钩子，一般用于加载插件CSS文件和代码 -->
<?php echo hook('pageHeader');?>

	<style>
		
		.container li {line-height: 29px;}
		th,td{font-size: 14px;}
		thead{background: #DED8D8;}
		th{text-align: center!important;}
		.Pagination a:hover,.current{background-color: #DCDADA;border: 1px solid #DCDADA;color: #ffffff; }
		.Pagination{float: right;height: auto;_height: 45px; line-height: 20px;margin-right: 15px;_margin-right: 5px; color:#565656;margin-top: 10px;_margin-top: 20px; clear:both;}
		.Pagination a,.Pagination span{ font-size: 14px;text-decoration: none;display: block;float: left;color: #565656;border: 1px solid #ccc;height: 34px;line-height: 34px;margin: 0 2px;width: 34px;text-align: center;}
		.footer{padding: 20px;}
		#info{width: 500px;float: left;margin-left: 20px;font-size: 14px;max-width: 600px;}
		#info>span{line-height: 25px;}
		#film_info{float: left;width: 600px;margin-left: 20px;font-size: 13px;margin-top: 20px;}
		#film_info h4{font-size: 20px;height: inherit;margin-top: 15px;}
		#interest_sectl{float: left;width: 600px;margin-left: 20px;font-size: 14px;margin-top: 20px;}
		#download_link{border:1px solid #000;}
		.well-large{padding: 12px!important;}
		.well{margin: 10px 0 10px 0!important;}
   		.charts_div{border: 1px solid #fff;width:100%;height:600px!important;padding: 50px 0 40px 0;margin-bottom: 100px;}
 
/*		#download_link ul li{float: left;margin-left: 22px;font-size: 14px;}
*/		
	</style>
</head>
<body>
	<!-- 头部 -->
	<div class="navbar navbar-inverse navbar-fixed-top">
	<div class="navbar-inner">
		<div class="container">
			 <a class="brand" href="<?php echo U('index/index');?>">主题爬虫设计</a>
            <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <div class="nav-collapse collapse">
                <ul class="nav">
                    <li>
                    	<a href="<?php echo U('Index/index');?>">首页</a>
                    </li>
                </ul>
            </div>
			 <div class="nav-collapse collapse">
                <ul class="nav">
                    <li>
                    	<a href="<?php echo U('Zuixin/index');?>">最新电影</a>
                    </li>
                </ul>
            </div>
            <div class="nav-collapse collapse">
                <ul class="nav">
                    <li>
                    	<a href="<?php echo U('Guonei/index');?>">国内电影</a>
                    </li>
                </ul>
            </div>
            <div class="nav-collapse collapse">
                <ul class="nav">
                    <li>
                    	<a href="<?php echo U('Oumei/index');?>">欧美电影</a>
                    </li>
                </ul>
            </div>
            <div class="nav-collapse collapse">
                <ul class="nav">
                    <li>
                    	<a href="<?php echo U('Rihan/index');?>">日韩电影</a>
                    </li>
                </ul>
            </div>
			<div class="nav-collapse collapse">
                <ul class="nav">
                    <li>
                    	<a href="<?php echo U('Zonghe/index');?>">综合电影</a>
                    </li>
                </ul>
            </div>
            <div class="nav-collapse collapse">
                <ul class="nav">
                    <li>
                    	<a href="<?php echo U('Analyse/index');?>">数据分析</a>
                    </li>
                </ul>
            </div>


		</div>
	</div>
	
</div>
	<!-- /头部 -->
	
	<!-- 主体 -->
	
    <header class="jumbotron subhead" id="overview">
        <div class="container">
            <h2>数据分析</h2>
            <p class="lead"></p>
        </div>
    </header>

<div id="main-container" class="container">
    <div class="row">
        
        <!-- 左侧 nav
        ================================================== -->
            <div class="span3 bs-docs-sidebar">
                
                <ul class="nav nav-list bs-docs-sidenav">
                   
                </ul>
            </div>
        
        
		<div id="main"  class="charts_div" ></div>
		<div id="main1" class="charts_div"></div>
		<div id="main2"  class="charts_div"></div>
		<div class="container">
			<h2 style="text-align: center;margin-bottom: 63px;">豆瓣影评综合得分百佳影片<br><small>数据仅作为测试使用，不代表真实结果<br />计算公式：综合得分 = (影评*0.82 + 评价人数*0.18)/2000</small></h2>
			<table class="table table-hover">
				<thead>
					<tr>
						<th>排名</th>
						<th>电影名称</th>
						<th>电影类型</th>
						<th>豆瓣评分</th>
						<th>参与人数</th>
						<th>综合得分</th>
						<th>电影详情</th>
					</tr>
				</thead>
				<tbody>
					<?php if(is_array($data['rank_3'])): $k = 0; $__LIST__ = array_slice($data['rank_3'],0,100,true);if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$film_rank): $mod = ($k % 2 );++$k;?><tr>
							<th>第 <?php echo ($k); ?> 名</th>
							<th>《<?php echo ($film_rank["film_name_real"]); ?>》</th>
							<th><?php echo ($film_rank["film_type"]); ?></th>
							<th><?php echo ($film_rank["film_score"]); ?>分</th>
							<th><?php echo ($film_rank["film_vote"]); ?>人</th>
							<th><?php echo ($film_rank["rank_score"]); ?></th>
							<th><a href="<?php echo U('Download/download?id='.$film_rank['id'].'&film_name='.$film_rank['film_name_real']);?>" target="_blank">查看</a></th>
						</tr><?php endforeach; endif; else: echo "" ;endif; ?>
					<!--<?php $__FOR_START_939893701__=1;$__FOR_END_939893701__=100;for($data['rank_3']=$__FOR_START_939893701__;$data['rank_3'] < $__FOR_END_939893701__;$data['rank_3']+=1){ ?><tr>
							<th><?php echo ($data['rank_3'][$i]['ranking']); ?></th>
							<th></th>
							<th></th>
							<th></th>
							<th></th>
							<th></th>
							<th></th>
						</tr><?php } ?>-->
					
				</tbody>
			</table>
		</div>
	
	
	<script src="/Crawler/Public/static/chart/echarts-all.js"></script>
	<script type="text/javascript">
	
       // 基于准备好的dom，初始化echarts图表
        var myChart = echarts.init(document.getElementById('main'));
        var myChart1 = echarts.init(document.getElementById('main1')); 
        var myChart2 = echarts.init(document.getElementById('main2')); 
        


	var option = {
	    title : {
	        text: '电影分类分析',
	        subtext: '',
	        x:'center'
	    },
	    tooltip : {
	        trigger: 'item',
	        formatter: "{a} <br/>{b} : {c} ({d}%)"
	    },
	    legend: {
	        orient : 'vertical',
	        x : 'left',
	        data:[<?php if(is_array($data['rank_type'])): $i = 0; $__LIST__ = $data['rank_type'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rank_type): $mod = ($i % 2 );++$i;?>"<?php echo ($rank_type["type_name"]); ?>",<?php endforeach; endif; else: echo "" ;endif; ?>]
	    },
	    toolbox: {
	        show : true,
	        feature : {
	            mark : {show: true},
	            dataView : {show: true, readOnly: false},
	            magicType : {
	                show: true, 
	                type: ['pie', 'funnel'],
	                option: {
	                    funnel: {
	                        x: '25%',
	                        width: '50%',
	                        funnelAlign: 'left',
	                        max: 1548
	                    }
	                }
	            },
	            restore : {show: true},
	            saveAsImage : {show: true}
	        }
	    },
	    calculable : true,
	    series : [
	        {
	            name:'访问来源',
	            type:'pie',
	            radius : '55%',
	            center: ['50%', '60%'],
	            data:[
	            <?php if(is_array($data['rank_type'])): $i = 0; $__LIST__ = $data['rank_type'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rank_type): $mod = ($i % 2 );++$i;?>{test:{},value:<?php echo ($rank_type["rank_score"]); ?>, name:'<?php echo ($rank_type["type_name"]); ?>'},<?php endforeach; endif; else: echo "" ;endif; ?>
	            ]
	        }
	    ]
	};
                    
	
	var	option1 = {
    title : {
        text: '电影类型数据分析',
        subtext: 'version 1.0'
    },
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['评分平均值','投票平均值']
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            magicType : {show: true, type: ['line', 'bar']},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    xAxis : [
        {
            type : 'category',
            data : [<?php if(is_array($data['rank_1'])): $i = 0; $__LIST__ = $data['rank_1'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rank_1): $mod = ($i % 2 );++$i;?>"<?php echo ($rank_1["film_type"]); ?>",<?php endforeach; endif; else: echo "" ;endif; ?>]
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name:'评分平均值',
            type:'bar',
            data:[<?php if(is_array($data['rank_1'])): $i = 0; $__LIST__ = $data['rank_1'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rank_1): $mod = ($i % 2 );++$i; echo ($rank_1["avg_score"]); ?>,<?php endforeach; endif; else: echo "" ;endif; ?>],
            markPoint : {
                data : [
                    {type : 'max', name: '最大值'},
                    {type : 'min', name: '最小值'}
                ]
            },
            markLine : {
                data : [
                    {type : 'average', name: '平均值'}
                ]
            }
        },
        {
            name:'投票平均值',
            type:'bar',
            data:[<?php if(is_array($data['rank_1'])): $i = 0; $__LIST__ = $data['rank_1'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rank_1): $mod = ($i % 2 );++$i; echo ($rank_1["avg_vote"]); ?>,<?php endforeach; endif; else: echo "" ;endif; ?>],
            markPoint : {
                data : [
                    {type : 'max', name: '最大值'},
                    {type : 'min', name: '最小值'}
                ]
            },
            markLine : {
                data : [
                    {type : 'average', name : '平均值'}
                ]
            }
        }
    ]
};
                 
          var option2 = {
			    title : {
			        text: '电影类型数据具体分析',
			        subtext: 'version 1.0'
			    },
			    tooltip : {
			        trigger: 'axis'
			    },
			    legend: {
			        data:['评分平均值','投票平均值','加权平均']
			    },
			    toolbox: {
			        show : true,
			        feature : {
			            mark : {show: true},
			            dataView : {show: true, readOnly: false},
			            magicType : {show: true, type: ['line', 'bar']},
			            restore : {show: true},
			            saveAsImage : {show: true}
			        }
			    },
			    calculable : true,
			    xAxis : [
			        {
			            type : 'category',
			            data : [<?php if(is_array($data['rank_2'])): $i = 0; $__LIST__ = $data['rank_2'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rank_2): $mod = ($i % 2 );++$i;?>"<?php echo ($rank_2["film_type"]); ?>",<?php endforeach; endif; else: echo "" ;endif; ?>]
			        }
			    ],
			    yAxis : [
			        {
			            type : 'value'
			        }
			    ],
			    series : [
			        {
			            name:'评分平均值',
			            type:'bar',
			            data:[<?php if(is_array($data['rank_2'])): $i = 0; $__LIST__ = $data['rank_2'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rank_2): $mod = ($i % 2 );++$i; echo ($rank_2["avg_score"]); ?>,<?php endforeach; endif; else: echo "" ;endif; ?>],
			            markPoint : {
			                data : [
			                    {type : 'max', name: '最大值'},
			                    {type : 'min', name: '最小值'}
			                ]
			            },
			            markLine : {
			                data : [
			                    {type : 'average', name: '平均值'}
			                ]
			            }
			        },
			        {
			            name:'投票平均值',
			            type:'bar',
			            data:[<?php if(is_array($data['rank_2'])): $i = 0; $__LIST__ = $data['rank_2'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rank_2): $mod = ($i % 2 );++$i; echo ($rank_2["avg_vote"]); ?>,<?php endforeach; endif; else: echo "" ;endif; ?>],
			            markPoint : {
			                data : [
			                    {type : 'max', name: '最大值'},
			                    {type : 'min', name: '最小值'}
			                ]
			            },
			            markLine : {
			                data : [
			                    {type : 'average', name : '平均值'}
			                ]
			            }
			        },
			        {
			            name:'加权平均',
			            type:'bar',
			            data:[<?php if(is_array($data['rank_2'])): $i = 0; $__LIST__ = $data['rank_2'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rank_2): $mod = ($i % 2 );++$i; echo ($rank_2["jiaquan"]); ?>,<?php endforeach; endif; else: echo "" ;endif; ?>],
			            markPoint : {
			                data : [
			                    {type : 'max', name: '最大值'},
			                    {type : 'min', name: '最小值'}
			                ]
			            },
			            markLine : {
			                data : [
			                    {type : 'average', name : '平均值'}
			                ]
			            }
			        }
			    ]
			};   
                    

          // 为echarts对象加载数据 
        myChart.setOption(option);
        myChart1.setOption(option1); 
        myChart2.setOption(option2);
    </script>
    <style>
    
    </style>
    

    </div>
</div>

<script type="text/javascript">
    $(function(){
        $(window).resize(function(){
            $("#main-container").css("min-height", $(window).height() - 343);
        }).resize();
    })
</script>
	<!-- /主体 -->
	

	<!-- 底部 -->
	
    <!-- 底部
    ================================================== -->
    <footer class="footer">
      <div class="container">
          <p> <strong>CopyRight © EasonHan 2015</strong></p>
      </div>
    </footer>


 <!-- 用于加载js代码 -->
<!-- 页面footer钩子，一般用于加载插件JS文件和JS代码 -->
<?php echo hook('pageFooter', 'widget');?>
<div class="hidden"><!-- 用于加载统计代码等隐藏元素 -->
	
</div>

	<!-- /底部 -->
</body>
</html>